<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>

<!-- ========================= -->
<!-- root element: wipFlush -->
<!-- ========================= -->


<xsl:template match="wipFlush">

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

        <fo:layout-master-set>
            <fo:simple-page-master master-name="A4-portrait"
                                page-height="11in"
                                page-width="8.5in"
                                margin-top="5mm"
                                margin-bottom="5mm"
                                margin-left="10mm"
                                margin-right="10mm">

                <fo:region-body />
                <fo:region-after extent="30mm"/>

            </fo:simple-page-master>
        </fo:layout-master-set>

        <fo:page-sequence master-reference="A4-portrait">

            <!--============================== -->
            <!-- Page Number block             -->
            <!--============================== -->

            <fo:static-content flow-name="xsl-region-after">
                <fo:block font-size="7pt" font-weight="bold" text-align="right">
                    Page <fo:page-number />
                    of
                    <fo:page-number-citation ref-id="endofdoc"/>

                </fo:block>
            </fo:static-content>

            <fo:flow flow-name="xsl-region-body">

                <fo:block text-align="center" font-size="10pt" space-after="1cm" font-weight="bold">Wip Flush Inventory Report- <xsl:value-of select="currentDate"/></fo:block>

                <fo:block space-after="1cm">
                    <fo:table width="100%" table-layout="fixed">
                        <fo:table-column column-width="30mm"/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-column/>
                        <fo:table-body>
                            <fo:table-row height="0.6cm" background-color="#DEE1E2">
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center" hyphenate="true" language = "en">Part Number</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Fab</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Wafer Store</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Sort</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">DieBank</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Assembly</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Test</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">InTransit</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Class Store</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Prog Release</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Finished Goods</fo:block>
                                </fo:table-cell>
                                <fo:table-cell border="1pt double black" display-align="center" >
                                    <fo:block font-weight="bold" font-size="9pt" text-align="center">Backlogs</fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <xsl:for-each select="/wipFlush/baseProducts/group/baseProduct">
                                <fo:table-row height="0.4cm" background-color="#F2DBDB">
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="left" hyphenate="true" language = "en">
                                            <xsl:value-of select="partNumber"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedFabQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedWaferStoreQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedSortQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedDieBankQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedAssemblyQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedTestQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedInTransitQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedClassStoreQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" font-style="italic" text-align="right">
                                            <xsl:value-of select="formattedProgramReleaseQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedFgQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="formattedBacklogQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <xsl:for-each select="childProducts/childProduct">
                                    <fo:table-row height="0.4cm" background-color="#CDCEE9">
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="left" hyphenate="true" language = "en">
                                                <xsl:value-of select="partNumber"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedFabQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedWaferStoreQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedSortQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedDieBankQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedAssemblyQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedTestQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedInTransitQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedClassStoreQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" font-style="italic" text-align="right">
                                                <xsl:value-of select="formattedProgramReleaseQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedFgQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border="1pt double black" display-align="center" >
                                            <fo:block font-weight="bold" font-size="7pt" text-align="right">
                                                <xsl:value-of select="formattedBacklogQty"/>
                                            </fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </xsl:for-each>
                            </xsl:for-each>
                                <fo:table-row height="0.4cm" background-color="#DEE1E2">
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="left" hyphenate="true" language = "en">
                                            Grand Total
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="fabTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="waferStoreTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="sortTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="dieBankTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="assemblyTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="testTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="inTransitTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="classStoreTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" font-style="italic" text-align="right">
                                            <xsl:value-of select="programReleaseQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="fgTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border="1pt double black" display-align="center" >
                                        <fo:block font-weight="bold" font-size="8pt" text-align="right">
                                            <xsl:value-of select="backlogTotalQty"/>
                                        </fo:block>
                                    </fo:table-cell>
                            </fo:table-row>
                        </fo:table-body>
                    </fo:table>
                </fo:block>

                <fo:block id="endofdoc"></fo:block>
            </fo:flow>
        </fo:page-sequence>
    </fo:root>
</xsl:template>

</xsl:stylesheet>
